// WindowLocker.h: interface for the WindowLocker class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_WINDOWLOCKER_H__21616BC1_5F59_4002_BF76_ECD968ADE88C__INCLUDED_)
#define AFX_WINDOWLOCKER_H__21616BC1_5F59_4002_BF76_ECD968ADE88C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <afxpriv.h>

class WindowLocker  
{
public:
	WindowLocker(CWnd * pWnd, bool bIncludeThis = false);
	virtual ~WindowLocker();

  void Lock() {BeginModalState();}
  void Unlock() {EndModalState();}
  bool IsLocked() {return InModalState();}

private:
  void BeginModalState();
  void EndModalState();
  bool InModalState() const {return m_cModalStack != 0;}
  bool IsDescendant(HWND hWndParent, HWND hWndChild);
  HWND GetParentOwner(HWND hWnd);

private:
  CWnd * m_pWnd;
  bool m_bIncludeThis;
  HWND * m_phWndDisable;       // windows disabled because of BeginModalState
  UINT m_cModalStack;
};

#endif // !defined(AFX_WINDOWLOCKER_H__21616BC1_5F59_4002_BF76_ECD968ADE88C__INCLUDED_)
